#ifndef _BSP_TM1650_H
#define _BSP_TM1650_H
#include "driver/i2c.h"



#define     I2C_MASTER_SDA_PORT     GPIO_NUM_11
#define     I2C_MASTER_SCL_PORT     GPIO_NUM_10

#define I2C_MASTER_NUM I2C_NUM_0   /*!< I2C port number for master dev */

#define LED_DIG1_ADD  0X68
#define LED_DIG2_ADD  0X6A  
#define LED_DIG3_ADD  0X6C
#define LED_DIG4_ADD  0X6E



#define KEY_NO_BUTTON_PRESS  0X2E

#define KEY_DIG4_STATUS_PRESS  0X47        // A
#define KEY_DIG4_STRENGTH_PRESS  0X4F          // B
#define KEY_DIG4_TIME_PRESS  0X57            // C
#define KEY_DIG4_XUSHI_PRESS  0X5F           // D

// #define KEY_DIG4_A_RELEASE  0X07
// #define KEY_DIG4_B_RELEASE  0X0F
// #define KEY_DIG4_C_RELEASE  0X17
// #define KEY_DIG4_D_RELEASE  0X1F


union dig1_t{
    uint8_t dig1_byte;
    struct {
        uint8_t xu:1;
        uint8_t shi:1;
    }dig1_bit_t;
};

union dig2_t{
    uint8_t dig2_byte;
    struct {
        uint8_t time_90:1;
        uint8_t time_60:1;
        uint8_t time_30:1;
    }dig2_bit_t;
};

union dig3_t{
    uint8_t dig3_byte;
    struct {
        uint8_t temp_80:1;
        uint8_t temp_70:1;
        uint8_t temp_60:1;

    }dig3_bit_t;
};

union dig4_t{
    uint8_t dig4_byte;
    struct {
        uint8_t stop:1;
        uint8_t on:1;
    }dig4_bit_t;
};


typedef struct tm1650_led
{
    uint8_t led_dig1;
    uint8_t led_dig2;
    uint8_t led_dig3;
    uint8_t led_dig4;
}tm1650_led_t;


void task_tm1650(void* arg);
void TM1650_Init(void);
uint32_t tm1650_led_datatrans(void *display_struct);
#endif
